<?php require_once ADMINVIEWPATH.'admin_header.php'; ?>
<?php require_once ADMINVIEWPATH.'admin_menu.php'; ?>
<style type="text/css">
    .bg_floating{
        position: relative;
        height: 100%;
        display: block;
    }
    .bg_floating:hover{
        background-color:#000;
        opacity:0.4;
        background:url("<?=STATICURL?>img/default.png") no-repeat;
        cursor:pointer;
    }
    .active{
        opacity:0.9;
    }
    .cover_btn {
        background: url("<?=STATICURL?>img/ico.png") no-repeat ;
        display: inline-block;
        position: absolute;
        right: 2px;
        top: 52px;
        width: 23px;        
        height: 23px;       
    }
</style>
<!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                        <li>
                            <i class="fa fa-home"></i>
                            <a href="#">首页</a>
                        </li>
                        <li class="">
                            <a href="#">最新动态</a>
                        </li>
                    </ul>
                </div>
                <!-- /Page Breadcrumb -->
                <!-- Page Header -->
                <div class="page-header position-relative">
                    <!--Header Buttons-->
                    <div class="header-buttons">
                        <a class="sidebar-toggler" href="#">
                            <i class="fa fa-arrows-h"></i>
                        </a>
                        <a class="refresh" id="refresh-toggler" href="">
                            <i class="glyphicon glyphicon-refresh"></i>
                        </a>
                        <a class="fullscreen" id="fullscreen-toggler" href="#">
                            <i class="glyphicon glyphicon-fullscreen"></i>
                        </a>
                    </div>
                    <!--Header Buttons End-->
                </div>
                <!-- /Page Header -->
                <!-- Page Body -->
                <div class="page-body">
                   <form class="form-horizontal" role="form">
                        <div class="row">
                                <div class="col-lg-12">
                                    <div class="widget">
                                        <div class="widget-header bordered-bottom bordered-blue">
                                            <span class="widget-caption">添加最新动态</span>
                                        </div>
                                        <div class="widget-body">
                                            <div id="horizontal-form">
                                                <form class="form-horizontal" role="form">
                                                  
                                                    <div class="row">
                                                        <div class="col-md-6">
                                                            <input class="form-control it_title" type="text" value="<?php echo $NewsInfo['title']?>" placeholder="新闻标题">
                                                            <div class="horizontal-space"></div>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-md-12">
                                                            <label >动态详情</label>
                                                                <textarea class="form-control content" rows="3" id="content"  placeholder="动态详情" style="height:300px;"><?php echo $NewsInfo['content']?></textarea>
                                                            <div class="horizontal-space"></div>
                                                        </div>
                                                    </div>
                                                    <div>
                                                        <span id="js_submit" class="btn btn-default">提 交</span>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                    </form>
                </div>
            </div>
            <!-- /Page Body -->
        </div>
        <!-- /Page Content -->
<script src="<?= STATICURL; ?>js/jquery.min.js"></script>
<script src="<?php echo STATICURL; ?>layer/layer.js"></script>
<script src="<?= STATICURL; ?>kindeditor/kindeditor.js"></script>
<?php require_once ADMINVIEWPATH.'admin_footer.php'; ?>
<script src="<?php echo STATICURL; ?>js/swfupload.js"></script>
<script src="<?php echo STATICURL; ?>js/swfupload.queue.js"></script>
<script src="<?php echo STATICURL; ?>js/fileprogress.js"></script>
<script src="<?php echo STATICURL; ?>js/handlers.js"></script>
<script>
KindEditor.ready(function(K) {
    window.editor = K.create('#content');
});

$(document).ready(function(){
    $("#js_submit").on("click",function(){
        editor.sync();//Js获取值时前面添加
        var title = $(".it_title").val();
        var content = $("#content").val();
        if (title == ""){
            layer.msg("动态标题不能为空");
            $(".title").focus();return;
        }
        if(content == ""){
            layer.msg("动态内容不能为空");return false;   
        }
        
        var id = "<?php echo $NewsInfo['id']?$NewsInfo['id']:0; ?>";
        $.post("/luckydog/news/edit", {id:id,title:title,content:content}, function(data) {
            if (data) {
                layer.msg("成功");
                window.location.href="/luckydog/news";
            }else{
                layer.msg("啊哦，失败啦");
            }
        });
    });  
});
     
</script>






